/*************************************************
Author: will
Date: 3/11/2013
Description:
Notes: 
*************************************************/

#ifndef __CCoolingConfig_h__
#define __CCoolingConfig_h__

#include "CTArray.h"
#include "commclass.h"

class CCoolingConfigData
{
public:
    CCoolingConfigData()
        :_bHasConfig(false)
    {

    }

public:
    bool _bHasConfig;

    int _iBaseSec;
    int _iBasePrice;
};

class CCoolingConfig
{
public:
    CCoolingConfig()
    {
        _astCoolingConfigDatas.m_iUsedCount = _astCoolingConfigDatas.GetCount();
    }

    int AddConfig(int iID, CCoolingConfigData& stConfigData)
    {
        if (iID < COOLING_CONFIG_MIN || iID > COOLING_CONFIG_MAX
            || _astCoolingConfigDatas[iID]._bHasConfig)
        {
            CT_ERROR(("%d", iID));
            return RET_SYS_ERROR;
        }

        _astCoolingConfigDatas[iID] = stConfigData;
        _astCoolingConfigDatas[iID]._bHasConfig = true;
        return 0;
    }

    int GetConfig(int iID, CCoolingConfigData& stConfigData)
    {
        if (iID < COOLING_CONFIG_MIN || iID > COOLING_CONFIG_MAX
            || !_astCoolingConfigDatas[iID]._bHasConfig)
        {
            CT_ERROR(("%d", iID));
            return RET_SYS_ERROR;
        }

        stConfigData = _astCoolingConfigDatas[iID];
        return 0;
    }

public:
    CTLib::CTArray<CCoolingConfigData, MAX_COOLING_CONFIG_COUNT> _astCoolingConfigDatas;
};


#endif // __CCoolingConfig_h__

